﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Ks.Fs.Core.Common
{
    public class Util
    {        
        public static FileExtention CheckExtention(string filename)
        {
            string[] imgExtends = {"jpg","jpeg","gif","png","bmp"};
            string[] movExtends = { "mov","avi","flv","swf"};
            string[] officeEextends = { "doc", "docx", "xls", "xlsx","ppt","pptx","pdf"};
            string[] programExtends = { "exe","msi","com","bat" };
            string[] textExtends = { "txt" };
            string extention = Path.GetExtension(filename);

            if (imgExtends.Contains(extention))
            {
                return FileExtention.Image;
            }

            if (movExtends.Contains(extention))
            {
                return FileExtention.Movie;
            }

            if (officeEextends.Contains(extention))
            {
                return FileExtention.Office;
            }

            if (programExtends.Contains(extention))
            {
                return FileExtention.Program;
            }
           
            
            return FileExtention.Other;
        }
    }
}
